﻿using System;
using System.Drawing;
using System.Windows.Forms;
using MUnit;

namespace Common
{
    class TestLayoutHelper
    {
        [Setup]
        void Setup()
        {
            // This will be run once before each test method
        }

        Button CreateButton(int x, int y)
        {
            return new Button();
        }

        [Test]
        void ButtonLocations()
        {
            Rectangle rect = Rectangle.Empty;
            Form form = new Form();

            // Execute
            LayoutHelper.CreateControlsToFillClientArea(form, new Size(3, 4), this.CreateButton);

            // Verify
            foreach (Control control in form.Controls)
            {
                rect.Width = control.Location.X + control.Size.Width;
                rect.Height = control.Location.Y + control.Size.Height;
            }
            Verify.Equals(form.ClientRectangle, rect);
            Verify.Equals(12, form.Controls.Count);
        }

        [TearDown]
        void TearDown()
        {
            // This will be run once after each test method
        }
    }
}
